
###
 # @Author: xiaoxiaotaoya 1712331226@qq.com
 # @Date: 2023-02-07 22:05:24
 # @LastEditors: xiaoxiaotaoya 1712331226@qq.com
 # @LastEditTime: 2023-03-26 17:30:46
 # @FilePath: /trobot_dev_ros1/src/0_robot_startup/robot_bringup/sh/install_depends.sh
 # @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
### 
# install lslidar_x10_driver depends
sudo apt-get install libpcap-dev -y
sudo apt-get install ros-noetic-diagnostic-updater -y
sudo apt-get install ros-noetic-tf* -y

# install cartographer cartographer-rviz cartographer-ros ...
# sudo apt-get install ros-noetic-cartographer* -y

'''
# https://google-cartographer.readthedocs.io/en/latest/
sudo apt-get update
sudo apt-get install -y \
    clang \
    cmake \
    g++ \
    git \
    google-mock \
    libboost-all-dev \
    libcairo2-dev \
    libceres-dev \
    libcurl4-openssl-dev \
    libeigen3-dev \
    libgflags-dev \
    libgoogle-glog-dev \
    liblua5.2-dev \
    libsuitesparse-dev \
    lsb-release \
    ninja-build \
    python3-sphinx \
    stow
# Install Protocol Buffers and Abseil if available.
# No need to build it ourselves.
case "$(lsb_release -sc)" in
    jammy|bullseye)
        sudo apt-get install -y libgmock-dev protobuf-compiler libabsl-dev ;;
    focal|buster)
        sudo apt-get install -y libgmock-dev protobuf-compiler ;;
    bionic)
        ;;
esac

git clone https://github.com/abseil/abseil-cpp.git
cd abseil-cpp
git checkout 215105818dfde3174fe799600bb0f3cae233d0bf # 20211102.0
mkdir build
cd build
cmake -G Ninja \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_INSTALL_PREFIX=/usr/local/stow/absl \
  ..
ninja
sudo ninja install
cd /usr/local/stow
sudo stow absl


VERSION="v3.4.1"

# Build and install proto3.
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout tags/${VERSION}
mkdir build
cd build
cmake -G Ninja \
  -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  -DCMAKE_BUILD_TYPE=Release \
  -Dprotobuf_BUILD_TESTS=OFF \
  ../cmake
ninja
sudo ninja install

# Build and install Cartographer.
cd cartographer
mkdir build
cd build
cmake .. -G Ninja
ninja
CTEST_OUTPUT_ON_FAILURE=1 ninja test
sudo ninja install
'''

# install realsense
sudo apt-get install ros-noetic-librealsense2* -y
sudo apt-get install ros-noetic-realsense2-* -y
sudo apt-get install ros-noetic-robot-state-publisher -y

# sudo apt-get install git libssl-dev libusb-1.0-0-dev libudev-dev pkg-config libgtk-3-dev -y
# sudo apt-get install libglfw3-dev libgl1-mesa-dev libglu1-mesa-dev at -y
# ./scripts/setup_udev_rules.sh
# ./scripts/patch-realsense-ubuntu-lts.sh
# mkdir build && cd build
# cmake ../ -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false
# sudo make uninstall && make clean && make && sudo make install 

# base_controller
sudo apt-get install ros-noetic-serial -y

# ros_astra_camera
sudo apt install libgflags-dev  ros-$ROS_DISTRO-image-geometry ros-$ROS_DISTRO-camera-info-manager\
ros-$ROS_DISTRO-image-transport ros-$ROS_DISTRO-image-publisher libgoogle-glog-dev libusb-1.0-0-dev libeigen3-dev

git clone https://github.com/libuvc/libuvc.git
cd libuvc
mkdir build && cd build
cmake .. && make -j4
sudo make install
sudo ldconfig



# 查看 RK3588 芯片的序列号
root@orangepi5plus:~/trobot/trobot_dev_ros1# cat_serial.sh
Serial          : 4a4f3dd1fa1d18d9
# 